Change in openvpn[master]: Apply text-removal.sh script to Windows codebase
A message that is not in the archive (sent off-list or not yet received): gerrit.1736341120000.I8f53c49b885c7c9e36a78ca434ec021e6dc347e0@...2715...
Attention is currently required from: flichtenheld, plaisthos.
stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/853?usp=email )
Change subject: Apply text-removal.sh script to Windows codebase
......................................................................
Patch Set 1: Code-Review+2
(1 comment)
Patchset:
PS1:
Visually checked the changes, looks reasonable.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/853?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I8f53c49b885c7c9e36a78ca434ec021e6dc347e0
Gerrit-Change-Number: 853
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 27 Jan 2025 09:56:51 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: plaisthos, stipa.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/853?usp=email )
Change subject: Apply text-removal.sh script to Windows codebase
......................................................................
Patch Set 2:
This change is ready for review.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/853?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I8f53c49b885c7c9e36a78ca434ec021e6dc347e0
Gerrit-Change-Number: 853
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Tue, 18 Mar 2025 12:17:52 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos, stipa.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/853?usp=email )
Change subject: Apply text-removal.sh script to Windows codebase
......................................................................
Patch Set 2: Code-Review+2
(1 comment)
Patchset:
PS2:
had a +2 from lev, was lost on rebase/wip/ready
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/853?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I8f53c49b885c7c9e36a78ca434ec021e6dc347e0
Gerrit-Change-Number: 853
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Tue, 18 Mar 2025 17:23:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v2 1/1 Apply text-removal.sh script to Windows codebase
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/853
This mail reflects revision 2 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpnmsica/dllmain.c +4 -4
@@ -32,7 +32,7 @@#pragma comment(lib, "msi.lib")#endif #include <stdio.h> -#include <tchar.h> +#include <wchar.h> DWORD openvpnmsica_thread_data_idx =TLS_OUT_OF_INDEXES ;
@@ -160,13 +160,13 @@MsiRecordSetInteger (hRecordProg,3 , dwResult);/* Field 4: The Windows error description. */ -LPTSTR szErrMessage =NULL ; +LPWSTR szErrMessage =NULL ;if (FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_ALLOCATE_BUFFER |FORMAT_MESSAGE_IGNORE_INSERTS ,0 , dwResult,0 , - (LPTSTR )&szErrMessage, + (LPWSTR )&szErrMessage,0 ,NULL ) && szErrMessage) {
@@ -175,7 +175,7 @@ {if (szErrMessage[i]) { -if (!_istspace (szErrMessage[i])) +if (!iswspace (szErrMessage[i])) { i_last = i +1 ; }
src/openvpnmsica/msica_arg.c +13 -13
@@ -54,9 +54,9 @@void msica_arg_seq_add_head ( _Inout_ struct msica_arg_seq *seq, - _In_z_ LPCTSTR argument) + _In_z_ LPCWSTR argument) { -size_t argument_size = (_tcslen (argument) +1 ) *sizeof (TCHAR ); +size_t argument_size = (wcslen (argument) +1 ) *sizeof (WCHAR );struct msica_arg *p =malloc (sizeof (struct msica_arg ) + argument_size);if (p ==NULL ) {
@@ -75,9 +75,9 @@void msica_arg_seq_add_tail ( _Inout_ struct msica_arg_seq *seq, - _Inout_ LPCTSTR argument) + _Inout_ LPCWSTR argument) { -size_t argument_size = (_tcslen (argument) +1 ) *sizeof (TCHAR ); +size_t argument_size = (wcslen (argument) +1 ) *sizeof (WCHAR );struct msica_arg *p =malloc (sizeof (struct msica_arg ) + argument_size);if (p ==NULL ) {
@@ -90,19 +90,19 @@ } -LPTSTR +LPWSTR msica_arg_seq_join(_In_ const struct msica_arg_seq *seq) {/* Count required space. */ size_t size =2 /*x + zero-terminator*/ ;for (struct msica_arg *p = seq->head; p !=NULL ; p = p->next) { - size +=_tcslen (p->val) +1 /*space delimiter|zero-terminator*/ ; + size +=wcslen (p->val) +1 /*space delimiter|zero-terminator*/ ; } - size *=sizeof (TCHAR ); + size *=sizeof (WCHAR );/* Allocate. */ -LPTSTR str =malloc (size); +LPWSTR str =malloc (size);if (str ==NULL ) {msg (M_FATAL ,"%s: malloc(%u) failed" , __FUNCTION__, size);
@@ -115,18 +115,18 @@#endif /* Dummy argv[0] (i.e. executable name), for CommandLineToArgvW to work correctly when parsing this string. */ -_tcscpy (str,TEXT ("x" )); +wcscpy (str,L"x" );/* Join. */ -LPTSTR s = str +1 /*x*/ ; +LPWSTR s = str +1 /*x*/ ;for (struct msica_arg *p = seq->head; p !=NULL ; p = p->next) {/* Convert zero-terminator into space delimiter. */ - s[0 ] =TEXT (' ' ); + s[0 ] =L' ' ; s++;/* Append argument. */ -_tcscpy (s, p->val); - s +=_tcslen (p->val); +wcscpy (s, p->val); + s +=wcslen (p->val); }#ifdef _MSC_VER
src/openvpnmsica/msica_arg.h +5 -5
@@ -22,7 +22,7 @@#define MSICA_ARG_H #include <windows.h> -#include <tchar.h> +#include <wchar.h> #include "../tapctl/basic.h"
@@ -38,7 +38,7 @@struct msica_arg {struct msica_arg *next;/**< Pointer to the next argument in the sequence */ -TCHAR val[];/**< Zero terminated argument string */ +WCHAR val[];/**< Zero terminated argument string */ };
@@ -80,7 +80,7 @@void msica_arg_seq_add_head ( _Inout_ struct msica_arg_seq *seq, - _In_z_ LPCTSTR argument); + _In_z_ LPCWSTR argument);/**
@@ -93,7 +93,7 @@void msica_arg_seq_add_tail ( _Inout_ struct msica_arg_seq *seq, - _Inout_ LPCTSTR argument); + _Inout_ LPCWSTR argument);/** * Join arguments of the argument sequence into a space delimited string
@@ -102,7 +102,7 @@* * @return Joined argument string. Must be released with free() after use. */ -LPTSTR +LPWSTR msica_arg_seq_join(_In_ const struct msica_arg_seq *seq);#ifdef _MSC_VER
src/openvpnmsica/msiex.c +24 -24
147 lines not on this page · raw message
src/openvpnmsica/msiex.h +5 -5
@@ -41,8 +41,8 @@UINT msi_get_string ( _In_ MSIHANDLE hInstall, - _In_z_ LPCTSTR szName, - _Out_ LPTSTR *pszValue); + _In_z_ LPCWSTR szName, + _Out_ LPWSTR *pszValue);/**
@@ -61,7 +61,7 @@msi_get_record_string ( _In_ MSIHANDLE hRecord, _In_ unsigned int iField, - _Out_ LPTSTR *pszValue); + _Out_ LPWSTR *pszValue);/**
@@ -83,7 +83,7 @@msi_format_record ( _In_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, - _Out_ LPTSTR *pszValue); + _Out_ LPWSTR *pszValue);/**
@@ -107,6 +107,6 @@ _In_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _In_ unsigned int iField, - _Out_ LPTSTR *pszValue); + _Out_ LPWSTR *pszValue);#endif /* ifndef MSIHLP_H */
src/openvpnmsica/openvpnmsica.c +93 -93
476 lines not on this page · raw message
src/openvpnserv/common.c +43 -43
230 lines not on this page · raw message
src/openvpnserv/interactive.c +43 -43
318 lines not on this page · raw message
src/openvpnserv/service.c +40 -40
224 lines not on this page · raw message
src/openvpnserv/service.h +16 -16
@@ -36,11 +36,11 @@#include <winsock2.h> #include <windows.h> #include <stdlib.h> -#include <tchar.h> +#include <wchar.h> #include "../tapctl/basic.h" -#define APPNAME TEXT(PACKAGE) TEXT("serv") -#define SERVICE_DEPENDENCIES TEXT(TAP_WIN_COMPONENT_ID) TEXT("\0Dhcp\0\0") +#define APPNAME _L(PACKAGE) L"serv" +#define SERVICE_DEPENDENCIES _L(TAP_WIN_COMPONENT_ID) L"\0Dhcp\0\0"/* * Message handling
@@ -58,37 +58,37 @@typedef struct {openvpn_service_type type; -TCHAR *name; -TCHAR *display_name; -TCHAR *dependencies; +WCHAR *name; +WCHAR *display_name; +WCHAR *dependencies;DWORD start_type; }openvpn_service_t ;#define MAX_NAME 256typedef struct { -TCHAR exe_path[MAX_PATH ]; -TCHAR config_dir[MAX_PATH ]; -TCHAR ext_string[16 ]; -TCHAR log_dir[MAX_PATH ]; -TCHAR ovpn_admin_group[MAX_NAME ]; +WCHAR exe_path[MAX_PATH ]; +WCHAR config_dir[MAX_PATH ]; +WCHAR ext_string[16 ]; +WCHAR log_dir[MAX_PATH ]; +WCHAR ovpn_admin_group[MAX_NAME ];DWORD priority;BOOL append; }settings_t ;extern openvpn_service_t interactive_service; -extern LPCTSTR service_instance; +extern LPCWSTR service_instance; -VOID WINAPI ServiceStartInteractiveOwn(DWORD argc, LPTSTR *argv); +VOID WINAPI ServiceStartInteractiveOwn(DWORD argc, LPWSTR *argv); -VOID WINAPI ServiceStartInteractive(DWORD argc, LPTSTR *argv); +VOID WINAPI ServiceStartInteractive(DWORD argc, LPWSTR *argv);DWORD GetOpenvpnSettings (settings_t *s);BOOL ReportStatusToSCMgr (SERVICE_STATUS_HANDLE service,SERVICE_STATUS *status); -LPCTSTR GetLastErrorText (void ); +LPCWSTR GetLastErrorText (void ); -DWORD MsgToEventLog (DWORD flags,LPCTSTR lpszMsg, ...); +DWORD MsgToEventLog (DWORD flags,LPCWSTR lpszMsg, ...);/** * Convert a UTF-8 string to UTF-16
src/openvpnserv/validate.c +4 -4
@@ -158,7 +158,7 @@/* Get username */ if (!LookupAccountSidW (NULL , sid, username, &len, domain, &len, &sid_type)) { -MsgToEventLog (M_SYSERR ,TEXT ("LookupAccountSid" )); +MsgToEventLog (M_SYSERR ,L"LookupAccountSid" );/* not fatal as this is now used only for logging */ username[0 ] ='\0' ; domain[0 ] ='\0' ;
@@ -170,7 +170,7 @@ }else { -MsgToEventLog (M_SYSERR ,TEXT ("Failed to get the name of Administrators group. Using the default." )); +MsgToEventLog (M_SYSERR ,L"Failed to get the name of Administrators group. Using the default." );/* use the default value */ admin_group[0 ] =SYSTEM_ADMIN_GROUP ; }
@@ -182,7 +182,7 @@ ret =IsUserInGroup (sid, token_groups, admin_group[i]);if (ret) { -MsgToEventLog (M_INFO ,TEXT ("Authorizing user '%ls@%ls' by virtue of membership in group '%ls'" ), +MsgToEventLog (M_INFO ,L"Authorizing user '%ls@%ls' by virtue of membership in group '%ls'" , username, domain, admin_group[i]); goto out; }
@@ -302,7 +302,7 @@if (err != NERR_Success && err != NERR_GroupNotFound) {SetLastError (err); -MsgToEventLog (M_SYSERR ,TEXT ("In NetLocalGroupGetMembers for group '%ls'" ), group_name); +MsgToEventLog (M_SYSERR ,L"In NetLocalGroupGetMembers for group '%ls'" , group_name); }return ret;
src/openvpnserv/validate.h +2 -2
@@ -28,8 +28,8 @@#include "service.h" /* Authorized groups who can use any options and config locations */ -#define SYSTEM_ADMIN_GROUP TEXT("Administrators") -#define OVPN_ADMIN_GROUP TEXT("OpenVPN Administrators") +#define SYSTEM_ADMIN_GROUP L"Administrators" +#define OVPN_ADMIN_GROUP L"OpenVPN Administrators"/* The last one may be reset in registry: HKLM\Software\OpenVPN\ovpn_admin_group */ BOOL
src/tapctl/basic.h +2 -2
@@ -23,10 +23,10 @@#define BASIC_H #ifdef _UNICODE -#define PRIsLPTSTR "ls" +#define PRIsLPWSTR "ls"#define PRIsLPOLESTR "ls"#else -#define PRIsLPTSTR "s" +#define PRIsLPWSTR "s"#define PRIsLPOLESTR "ls"#endif #define PRIXGUID "{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}"
src/tapctl/main.c +142 -142
534 lines not on this page · raw message
src/tapctl/tap.c +57 -57
321 lines not on this page · raw message
src/tapctl/tap.h +6 -6
@@ -52,8 +52,8 @@DWORD tap_create_adapter ( _In_opt_ HWND hwndParent, - _In_opt_ LPCTSTR szDeviceDescription, - _In_ LPCTSTR szHwId, + _In_opt_ LPCWSTR szDeviceDescription, + _In_ LPCWSTR szHwId, _Inout_ LPBOOL pbRebootRequired, _Out_ LPGUID pguidAdapter);
@@ -126,7 +126,7 @@DWORD tap_set_adapter_name ( _In_ LPCGUID pguidAdapter, - _In_ LPCTSTR szName, + _In_ LPCWSTR szName, _In_ BOOL bSilent);
@@ -136,8 +136,8 @@struct tap_adapter_node {GUID guid;/**< Adapter GUID */ -LPTSTR szzHardwareIDs;/**< Device hardware ID(s) */ -LPTSTR szName;/**< Adapter name */ +LPWSTR szzHardwareIDs;/**< Device hardware ID(s) */ +LPWSTR szName;/**< Adapter name */ struct tap_adapter_node *pNext;/**< Pointer to next adapter */ };
@@ -165,7 +165,7 @@DWORD tap_list_adapters ( _In_opt_ HWND hwndParent, - _In_opt_ LPCTSTR szzHwIDs, + _In_opt_ LPCWSTR szzHwIDs, _Out_ struct tap_adapter_node **ppAdapterList);
[Openvpn-devel] [PATCH applied] Re: Apply text-removal.sh script to Windows codebase
Stared-at-code, as did Lev (whose +2 got lost due to gerrit flag changes).
Really 'just mechanically moving from TEXT("string") to L"string", "LPTSTR" to "LPWSTR" and so on'. I did a test compile on Ubuntu/MingW, and no warnings ensued.
Your patch has been applied to the master branch.
commit 236cd36dadcf71be0ca75b3b77eacfcc265d2abf
Author: Frank Lichtenheld Date: Tue Mar 18 18:23:42 2025 +0100
Apply text-removal.sh script to Windows codebase
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31159.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering